Skip to content

feat: speedup ebpf uprobe attaching#440

Open
not-matthias wants to merge 4 commits into
mainfrom
cod-3070-speedup-allocator-attaching-on-nixos
Open

feat: speedup ebpf uprobe attaching#440
not-matthias wants to merge 4 commits into
mainfrom
cod-3070-speedup-allocator-attaching-on-nixos

Conversation

@not-matthias

@not-matthias not-matthias commented Jul 7, 2026

Copy link
Copy Markdown
Member

No description provided.

@greptile-apps

greptile-apps Bot commented Jul 7, 2026

Copy link
Copy Markdown

Greptile Summary

This PR speeds up memtrack eBPF allocator attachment. The main changes are:

  • Adds offset resolution for allocator symbols before attaching probes.
  • Falls back to symbol-name attachment when a defined symbol has no file offset.
  • Resolves allocator libraries in parallel with Rayon.
  • Adds a CodSpeed benchmark for serial versus parallel offset resolution.
  • Extends CI benchmark coverage to include memtrack.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.

Important Files Changed

Filename Overview
crates/memtrack/src/ebpf/memtrack.rs Adds pre-resolved symbol offsets, by-name fallback for no-offset symbols, and parallel allocator-library resolution.
crates/memtrack/src/ebpf/tracker.rs Delegates bulk allocator attachment to the new MemtrackBpf::attach_allocators flow.
crates/memtrack/benches/attach.rs Adds benchmarks comparing serial and parallel allocator symbol offset resolution.
crates/memtrack/Cargo.toml Adds Rayon and registers the new attach benchmark.
.github/workflows/ci.yml Installs libbpf build dependencies and includes memtrack in benchmark build and run steps.

Reviews (3): Last reviewed commit: "ci(memtrack): run offset resolution benc..." | Re-trigger Greptile

Comment thread crates/memtrack/src/ebpf/memtrack.rs Outdated
Comment thread crates/memtrack/src/ebpf/memtrack.rs Outdated
Comment thread crates/memtrack/src/ebpf/memtrack.rs Outdated
@codspeed-hq

codspeed-hq Bot commented Jul 7, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

✅ 7 untouched benchmarks
🆕 2 new benchmarks

Performance Changes

Mode Benchmark BASE HEAD Efficiency
🆕 Simulation resolve_offsets_parallel N/A 10.5 ms N/A
🆕 Simulation resolve_offsets_serial N/A 10 ms N/A

Comparing cod-3070-speedup-allocator-attaching-on-nixos (9f32601) with main (eac7766)

Open in CodSpeed

@not-matthias not-matthias force-pushed the cod-3070-speedup-allocator-attaching-on-nixos branch from 0e8688a to 3a322ae Compare July 7, 2026 17:07
Comment thread crates/memtrack/src/ebpf/memtrack.rs Outdated
@not-matthias not-matthias marked this pull request as ready for review July 7, 2026 17:47
…f func_name

Resolve every defined symbol's libbpf-compatible file offset once per
library (st_value - sh_addr + sh_offset) and attach uprobes by offset,
replacing the per-probe func_name lookup that reparsed the ELF each time.
Symbol resolution parses each allocator ELF independently, so fan it out
across cores with rayon before the serial attach step. Cuts offset
resolution for all discovered allocators from ~190ms to ~29ms locally.
Divan bench comparing serial vs parallel symbol offset resolution over
the discovered allocator libraries. Runs without sudo since it only
parses ELFs, no eBPF attach.
@not-matthias not-matthias force-pushed the cod-3070-speedup-allocator-attaching-on-nixos branch from 3a322ae to 9f32601 Compare July 8, 2026 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant